<template>
    <div class="wrap">
        <el-form v-model="SYGENCODEX">
            <el-form-item label="包路径">
                <el-input v-model="SYGENCODEX.pkg"></el-input>
            </el-form-item>
            <el-form-item label="表名(多表以分号;分隔)">
                <el-input v-model="SYGENCODEX.tables"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="generate">生成</el-button>
            </el-form-item>
        </el-form>
        <a :href="SYGENCODEZ.url">{{SYGENCODEZ.name}}</a>
    </div>
</template>
<script>
export default {
    data () {
        return {
            SYGENCODEX: {
                pkg: '',
                tables: ''
            },
            SYGENCODEZ: {
                url: '',
                name: ''
            }
        };
    },
    methods: {
        generate () {
            let self = this
            var input = {
                a: [self.SYGENCODEX]
            }
            self.$http
                .post('/dev/code/gen', input)
                .then((res) => {
                    self.SYGENCODEZ = res.data.a[0]
                })
                .catch((err) => {
                    console.log(err)
                    self.$alert(err, '提示', {
                        confirmButtonText: '确定'
                    })
                })

        }
    }
}
</script>
<style scoped>
.wrap {
  width: 50%;
  position: relative;
  margin: 10px;
}
</style>
